package br.com.dj.persistencia;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import br.com.dj.entidade.Noticia;
import br.com.dj.enumerador.Status;

@Repository("noticiaDao")
public class NoticiaDao extends SuporteDao<Noticia> {

	@Override
	public Class<Noticia> getClasse() {
		return Noticia.class;
	}

	@SuppressWarnings("unchecked")
	public List<Noticia> coletarAtivas() {
		Criteria criteria = getSession().createCriteria(getClasse()).add(
				Restrictions.eq("status", Status.ATIVO));
		return criteria.list();
	}

}
